package com.pdg.dungeondelver.engine;

import java.util.Iterator;
import java.util.Map;
import com.pdg.dungeondelver.configuration.Configuration;
import com.pdg.dungeondelver.configuration.Descriptor;

public class AtlasCell extends DescriptoredHashMap<Integer,Layer>{

	/**
	 * 
	 */
	private static final long serialVersionUID = 4636499107155331541L;
	private AtlasColumn atlasColumn;
	public AtlasCell(AtlasColumn atlasColumn){
		super(new Descriptor());
		setColumn(atlasColumn);
	}
	private void setColumn(AtlasColumn theAtlasColumn) {
		atlasColumn = theAtlasColumn;
		
	}
	public AtlasColumn getColumn(){
		return atlasColumn;
	}
	public Configuration getConfiguration(){
		return getColumn().getConfiguration();
	}
	public Atlas getAtlas(){
		return getColumn().getAtlas();
	}
	public Integer getRowId(){
		Iterator<Map.Entry<Integer,AtlasCell>> iterator = getColumn().entrySet().iterator();
		while(iterator.hasNext()){
			Map.Entry<Integer,AtlasCell> entry = iterator.next();
			if(entry.getValue().equals(this)){
				return entry.getKey();
			}
		}
		return null;
	}
}
